package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckGroupCheckItemMapper {
    /**
     * 批量新增
     * @param groupId
     * @param checkitemIds
     */
    void insert(Integer groupId, Integer[] checkitemIds);

    /**
     * 根据检查组id删除中间表数据
     * @param id
     */
    @Delete("delete from check_group_check_item where check_group_id = #{id}")
    void deleteByGroupId(Integer id);

    /**
     * 根据检查组id查询中间表数据
     * @param id
     * @return
     */
    @Select("select check_item_id from check_group_check_item where check_group_id = #{id}")
    List<Integer> findItemIdsByCheckGroupId(Integer id);
}
